<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SC2API: sc2::QueryInterface Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="SC2-Logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">SC2API
   </div>
   <div id="projectbrief">An API for AI for StarCraft II</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>sc2</b></li><li class="navelem"><a class="el" href="classsc2_1_1_query_interface.html">QueryInterface</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classsc2_1_1_query_interface-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">sc2::QueryInterface Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="sc2__interfaces_8h_source.html">sc2_interfaces.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsc2_1_1_query_interface_1_1_pathing_query.html">PathingQuery</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsc2_1_1_query_interface_1_1_placement_query.html">PlacementQuery</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a76a602ebb27600b636712bd0bf062201"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="structsc2_1_1_available_abilities.html">AvailableAbilities</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_query_interface.html#a76a602ebb27600b636712bd0bf062201">GetAbilitiesForUnit</a> (const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *unit, bool ignore_resource_requirements=false)=0</td></tr>
<tr class="separator:a76a602ebb27600b636712bd0bf062201"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8b50ebad97a2f1139045a61b85a3300d"><td class="memItemLeft" align="right" valign="top">virtual std::vector&lt; <a class="el" href="structsc2_1_1_available_abilities.html">AvailableAbilities</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_query_interface.html#a8b50ebad97a2f1139045a61b85a3300d">GetAbilitiesForUnits</a> (const Units &amp;units, bool ignore_resource_requirements=false)=0</td></tr>
<tr class="separator:a8b50ebad97a2f1139045a61b85a3300d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adf72c7556e59e82e231d9c58bd093546"><td class="memItemLeft" align="right" valign="top">virtual float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_query_interface.html#adf72c7556e59e82e231d9c58bd093546">PathingDistance</a> (const <a class="el" href="structsc2_1_1_point2_d.html">Point2D</a> &amp;start, const <a class="el" href="structsc2_1_1_point2_d.html">Point2D</a> &amp;end)=0</td></tr>
<tr class="separator:adf72c7556e59e82e231d9c58bd093546"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a757adb07f0f93e4b289ecf3ea0c4358b"><td class="memItemLeft" align="right" valign="top">virtual float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_query_interface.html#a757adb07f0f93e4b289ecf3ea0c4358b">PathingDistance</a> (const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *start, const <a class="el" href="structsc2_1_1_point2_d.html">Point2D</a> &amp;end)=0</td></tr>
<tr class="separator:a757adb07f0f93e4b289ecf3ea0c4358b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae23848466df99bfb7c3da9fbabc7f47b"><td class="memItemLeft" align="right" valign="top"><a id="ae23848466df99bfb7c3da9fbabc7f47b"></a>
virtual std::vector&lt; float &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_query_interface.html#ae23848466df99bfb7c3da9fbabc7f47b">PathingDistance</a> (const std::vector&lt; <a class="el" href="structsc2_1_1_query_interface_1_1_pathing_query.html">PathingQuery</a> &gt; &amp;queries)=0</td></tr>
<tr class="memdesc:ae23848466df99bfb7c3da9fbabc7f47b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Issues multiple pathing queries. <br /></td></tr>
<tr class="separator:ae23848466df99bfb7c3da9fbabc7f47b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa5ee0fbda6e0eac6f096710328484d2a"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_query_interface.html#aa5ee0fbda6e0eac6f096710328484d2a">Placement</a> (const <a class="el" href="classsc2_1_1_s_c2_type.html">AbilityID</a> &amp;ability, const <a class="el" href="structsc2_1_1_point2_d.html">Point2D</a> &amp;target_pos, const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *unit=nullptr)=0</td></tr>
<tr class="separator:aa5ee0fbda6e0eac6f096710328484d2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a470e79785e2ffdb1a5c4636c8a070601"><td class="memItemLeft" align="right" valign="top">virtual std::vector&lt; bool &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_query_interface.html#a470e79785e2ffdb1a5c4636c8a070601">Placement</a> (const std::vector&lt; <a class="el" href="structsc2_1_1_query_interface_1_1_placement_query.html">PlacementQuery</a> &gt; &amp;queries)=0</td></tr>
<tr class="separator:a470e79785e2ffdb1a5c4636c8a070601"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The <a class="el" href="classsc2_1_1_query_interface.html">QueryInterface</a> provides additional data not contained in the observation.</p>
<p>Performance note:</p><ul>
<li>Always try and batch things up. These queries are effectively synchronous and will block until returned. </li>
</ul>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a76a602ebb27600b636712bd0bf062201"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a76a602ebb27600b636712bd0bf062201">&#9670;&nbsp;</a></span>GetAbilitiesForUnit()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="structsc2_1_1_available_abilities.html">AvailableAbilities</a> sc2::QueryInterface::GetAbilitiesForUnit </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *&#160;</td>
          <td class="paramname"><em>unit</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>ignore_resource_requirements</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Returns a list of abilities represented as a uint32_t see the ABILITY_ID enum for their corresponding, named, representations. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tag</td><td>Tag of unit. </td></tr>
    <tr><td class="paramname">ignore_resource_requirements</td><td>Ignores food, mineral and gas costs, as well as cooldowns. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Abilities for the unit. </dd></dl>

</div>
</div>
<a id="a8b50ebad97a2f1139045a61b85a3300d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8b50ebad97a2f1139045a61b85a3300d">&#9670;&nbsp;</a></span>GetAbilitiesForUnits()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual std::vector&lt;<a class="el" href="structsc2_1_1_available_abilities.html">AvailableAbilities</a>&gt; sc2::QueryInterface::GetAbilitiesForUnits </td>
          <td>(</td>
          <td class="paramtype">const Units &amp;&#160;</td>
          <td class="paramname"><em>units</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>ignore_resource_requirements</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Issues multiple available abilities queries. Batch version. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tag</td><td>Tags of units. </td></tr>
    <tr><td class="paramname">ignore_resource_requirements</td><td>Ignores food, mineral and gas costs, as well as cooldowns. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Abilities for the units. </dd></dl>

</div>
</div>
<a id="adf72c7556e59e82e231d9c58bd093546"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adf72c7556e59e82e231d9c58bd093546">&#9670;&nbsp;</a></span>PathingDistance() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual float sc2::QueryInterface::PathingDistance </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structsc2_1_1_point2_d.html">Point2D</a> &amp;&#160;</td>
          <td class="paramname"><em>start</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structsc2_1_1_point2_d.html">Point2D</a> &amp;&#160;</td>
          <td class="paramname"><em>end</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Returns pathing distance between two locations. Takes into account unit movement properties (e.g. Flying). </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">start</td><td>Starting point. </td></tr>
    <tr><td class="paramname">end</td><td>End point. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Distance between the two points. </dd></dl>

</div>
</div>
<a id="a757adb07f0f93e4b289ecf3ea0c4358b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a757adb07f0f93e4b289ecf3ea0c4358b">&#9670;&nbsp;</a></span>PathingDistance() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual float sc2::QueryInterface::PathingDistance </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *&#160;</td>
          <td class="paramname"><em>start</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structsc2_1_1_point2_d.html">Point2D</a> &amp;&#160;</td>
          <td class="paramname"><em>end</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Returns pathing distance between a unit and a target location. Takes into account unit movement properties (e.g. Flying). Batch version. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">start</td><td>Starting points. </td></tr>
    <tr><td class="paramname">end</td><td>End points. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Distances between the two points. </dd></dl>

</div>
</div>
<a id="aa5ee0fbda6e0eac6f096710328484d2a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa5ee0fbda6e0eac6f096710328484d2a">&#9670;&nbsp;</a></span>Placement() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool sc2::QueryInterface::Placement </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsc2_1_1_s_c2_type.html">AbilityID</a> &amp;&#160;</td>
          <td class="paramname"><em>ability</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structsc2_1_1_point2_d.html">Point2D</a> &amp;&#160;</td>
          <td class="paramname"><em>target_pos</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *&#160;</td>
          <td class="paramname"><em>unit</em> = <code>nullptr</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Returns whether a building can be placed at a location. The placing unit field is optional. This is only used for cases where the placing unit plays a role in the placement grid test (e.g. A flying barracks building an add-on requires room for both the barracks and add-on). </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ability</td><td>Ability for building or moving a structure. </td></tr>
    <tr><td class="paramname">end</td><td>target_pos Position to attempt placement on. </td></tr>
    <tr><td class="paramname">placing_unit_tag_</td><td>(Optional) The unit that is moving, if moving a structure. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>If placement is possible. </dd></dl>

</div>
</div>
<a id="a470e79785e2ffdb1a5c4636c8a070601"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a470e79785e2ffdb1a5c4636c8a070601">&#9670;&nbsp;</a></span>Placement() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual std::vector&lt;bool&gt; sc2::QueryInterface::Placement </td>
          <td>(</td>
          <td class="paramtype">const std::vector&lt; <a class="el" href="structsc2_1_1_query_interface_1_1_placement_query.html">PlacementQuery</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>queries</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>A batch version of the above Placement query. Takes an array of abilities, positions and optional unit tags and returns a matching array of bools indicating if placement is possible. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">queries</td><td>Placement queries. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Array of bools indicating if placement is possible. </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>include/sc2api/<a class="el" href="sc2__interfaces_8h_source.html">sc2_interfaces.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
